<template>
  <div class="app-container">
    <wms-form v-model:query-params="queryParams" :form-list="formList" @query="getList" @export="handleExport">
    </wms-form>
    <wms-table :loading="loading" :data-list="locationList" :column="column" :pageInfo="queryParams"
      @get-list="getList" />
  </div>
</template>

<script setup name="Location">
import {
  listLocation,
  getLocation,
  delLocation,
  addLocation,
  updateLocation,
} from "@/api/wms/location";
import WmsTable from '@/components/WmsTable/index.vue'
import WmsForm from '@/components/WmsForm/index.vue'
import { data, column, formList } from './index.js'
import { ref, reactive, getCurrentInstance, onMounted } from "vue";

const { proxy } = getCurrentInstance();
const queryParams = reactive(data.queryParams);
const locationList = ref([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);

/** 查询货位资料列表 */
function getList() {
  loading.value = true;
  listLocation(queryParams).then((response) => {
    locationList.value = response.rows;
    queryParams.total = response.total;
    loading.value = false;
  });
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.pageNum = 1;
  getList();
}
/** 导出按钮操作 */
function handleExport() {
  proxy.download(
    "wms/location/export",
    {
      ...queryParams,
    },
    `货位详情_${new Date().getTime()}.xlsx`
  );
}

const switchChange = (status, row) => {
  // 修改状态接口
  row.isActive = status;
};
getList();


</script>
